package cn.sciento.starter.tenant.custom.endpoint;

import cn.sciento.swagger.annotation.Permission;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import cn.sciento.core.util.Results;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

@RestController
@ApiIgnore
public class CustomPointController {
  public static final String CUSTOM_POINT_URL = "/v2/tenant-custom/points";
  
  private final CustomPointScanner customPointScanner;
  
  public CustomPointController(CustomPointScanner customPointScanner) {
    this.customPointScanner = customPointScanner;
  }
  
  @ApiOperation("获取服务中租户客户化的端点")
  @Permission(permissionWithin = true)
  @GetMapping({"/v2/tenant-custom/points"})
  @ResponseBody
  public ResponseEntity<List<CustomPointDTO>> listCustomPoints() {
    return Results.success(this.customPointScanner.getCustomPoints());
  }
}
